local AnimateMgr  = class("AnimateMgr");
function AnimateMgr:ctor()

end

function AnimateMgr:createAnimate(args)
    local name = args.name;
    local frameName = args.frameName;
    local start = args.start or 0;
    local endIndex = args.endIndex;
    local runTime = args.time;
    local frames = display.newFrames(frameName,start,endIndex);
    local animation = display.newAnimation(frames, runTime / (endIndex - start + 1));
    self:addAnimation(animation,name);
end

function AnimateMgr:getAnimation(name)
    return cc.AnimationCache:getInstance():getAnimation(name);
end
function AnimateMgr:addAnimation(animation,name)
    cc.AnimationCache:getInstance():addAnimation(animation,name);
end
function AnimateMgr:removeAnimationByName(name)
    cc.AnimationCache:getInstance():removeAnimationByName(name);
end
function AnimateMgr:getAnimate(name)
    local animation = self:getAnimation(name);
    if animation then
        return cc.Animate:create(animation);
    end
    return nil;
end

function AnimateMgr:getFirstFrame(name)
    local animation = self:getAnimation(name);
    if animation then
        return animation:getFrames():objectAtIndex(0):getSpriteFrame();
    end
    return nil;
end

mgrs.animate = nil;
mgrs.singleClass(mgrs,AnimateMgr,"animate");
--endregion
